package DesignPattern.decorator;

/**
 * @Author self
 * @Date 2025/7/13 11:27
 * @Describe
 */
public class Main {
    public static void main(String[] args) {
        // 最基础的咖啡
        Coffee coffee = new SimpleCoffee();
        System.out.println("Cost: $" + coffee.cost());
        System.out.println("Description: " + coffee.description());

        // 加牛奶的咖啡
        Coffee milkCoffee = new MilkDecorator(new SimpleCoffee());
        System.out.println("Cost: $" + milkCoffee.cost());
        System.out.println("Description: " + milkCoffee.description());

        // 加牛奶和糖的咖啡
        Coffee milkAndSugarCoffee = new SugarDecorator(new MilkDecorator(new SimpleCoffee()));
        System.out.println("Cost: $" + milkAndSugarCoffee.cost());
        System.out.println("Description: " + milkAndSugarCoffee.description());

        // 加牛奶、糖和奶油的咖啡
        Coffee fancyCoffee = new CreamDecorator(
                new SugarDecorator(
                        new MilkDecorator(new SimpleCoffee())));
        System.out.println("Cost: $" + fancyCoffee.cost());
        System.out.println("Description: " + fancyCoffee.description());
    }
}
